<?php

namespace app\admin\controller\knowbase;

use app\admin\controller\auth\Group;
use app\admin\model\AuthGroup;
use app\common\controller\Backend;
use fast\Tree;
use think\Db;
use think\Exception;

/**
 * 角色组
 *
 * @icon   fa fa-group
 * @remark 角色组可以有多个,角色有上下级层级关系,如果子角色有角色组和管理员的权限则可以派生属于自己组别下级的角色组或管理员
 */
class GroupNew extends Group
{


    /**
     * 查看
     */
    public function index()
    {
        if ($this->request->isAjax()) {
            $list = $this->grouplist;
            foreach ($list as &$v) {
                $v['name'] = str_replace("&nbsp;", ' ', $v['name']);
                unset($v['pid']);
                unset($v);
            }
            
           
            if($key = array_values(array_filter(explode(',',$this->request->request('keyValue'))))){
                $list = array_values(array_filter($list,function ($v) use($key){
                    return in_array($v['id'],$key);
                }));
            }
            
            $total = count($list);
            $result = array("total" => $total, "rows" => $list);

            return json($result);
        } else {
            return json([]);
        }
    }

    public function add() {
        return;
    }
    public function edit($ids = null) {
        return;
    }
    public function del($ids = null) {
        return;
    }
    public function recyclebin() {
        return;
    }
    public function destroy($ids = null) {
        return;
    }
    public function restore($ids = null) {
        return;
    }
    public function multi($ids = null) {
        return;
    }
    
}
